@import "./var.scss";

:root,
body {
  --color-main: #{$color-main};
  --color-danger: #{$color-danger};
  --font-family: #{$font-family};
  --padding: #{$padding};
  --transition: #{$transition};

  --el-color-primary: #{$color-main};
}

html,
body {
  margin: 0;
  font-family: var(--font-family);
  line-height: 1;
  background: #eff3ff;
}

html {
  font-size: 12px;
}

@media screen and (max-width: 1600px) {
  html {
    font-size: 11px;
  }
}

@media screen and (max-width: 1366px) {
  html {
    font-size: 10px;
  }
}

h1,
h2,
h3,
h4,
h5 {
  font-weight: normal;
  margin: 0;
  font-size: 2rem;
}

p {
  line-height: 1.5;
  margin: 0;
}

a {
  text-decoration: none;
  color: inherit;
}

input[type="text"]:not(.el-input__inner),
input[type="number"]:not(.el-input__inner),
input[type="password"]:not(.el-input__inner),
select,
textarea {
  font-family: var(--font-family);
  padding: 0;
  background-color: transparent;
  box-sizing: border-box;
  border: #ccc 1px solid;
  border-radius: 0.625rem;
  outline: none;
  font-size: 1.4rem;
  transition: var(--transition);
  &:focus {
    border-color: var(--color-main);
  }
}

button {
  font-family: var(--font-family);
  border: none;
  background: transparent;
  outline: none;
  border-radius: 0.625rem;
  cursor: pointer;
  font-size: 1.125rem;
  &:disabled {
    opacity: 0.7;
    cursor: not-allowed;
  }
}

img {
  vertical-align: middle;
}

// color
.bg-main {
  background-color: var(--color-main);
  color: #fff;
}
.bg-danger {
  background-color: var(--color-danger);
  color: #fff;
}
.c-main {
  color: var(--color-main);
}
.c-danger {
  color: var(--color-danger);
}

// flex
.flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  &.center {
    justify-content: center;
  }
  &.stretch {
    align-items: stretch;
  }
  &.start {
    align-items: flex-start;
    justify-content: flex-start;
  }
  &.end {
    align-items: flex-end;
    justify-content: flex-end;
  }
  &.column {
    flex-direction: column;
  }
  &.wrap {
    flex-wrap: wrap;
  }
  .grow {
    flex-grow: 1;
  }
}

// align
$align: left, center, right;

@each $e in $align {
  .t-#{$e} {
    text-align: $e;
  }
}

@each $p in left, right {
  .f-#{$p} {
    float: $p;
  }
}

// padding、margin
.p-all {
  padding: var(--padding);
}
.m-all {
  margin: var(--padding);
}
@each $p in top, right, bottom, left {
  .p-#{$p} {
    padding-#{$p}: var(--padding);
  }
  .m-#{$p} {
    margin-#{$p}: var(--padding);
  }
}

// btn
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 3.75rem;
  line-height: 1;
  background-color: var(--color-main);
	border-radius: 1.875rem;
  font-size: 1.2rem;
  color: #fff;
  text-decoration: none;
  padding: 0 2.375rem;
  cursor: pointer;
  &-icon {
    margin-left: 0.875rem;
  }
  &.danger {
    background: #e8474f;
  }
  &.secondary {
    background: #cfd5e6;
  }
}

// switch
.switch {
  position: relative;
  width: 4.8rem;
	height: 2.4rem;
	background-color: var(--color-main);
  border-radius: 1.2rem;
  cursor: pointer;
  .label {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 0;
    left: 2rem;
    top: 0;
    height: 100%;
    color: #fff;
    font-size: 1rem;
    transform: scale(0.8);
  }
  &::before {
    position: absolute;
    top: 0.2rem;
    left: 0.2rem;
    content: "";
    width: 2rem;
    height: 2rem;
    background: #fff;
    border-radius: 1rem;
  }
  &.off {
    background: #cfd5e6;
    &::before {
      left: 2.6rem;
    }
    .label {
      left: 0;
      right: 2rem;
    }
  }
}

// cursor
.pointer {
  cursor: pointer;
}

// app
.app {
  min-height: 100vh;
  font-size: 1.4rem;
}

.iconfont {
  font-size: 1.4rem;
  vertical-align: middle;
}

.link {
  color: inherit;
  text-decoration: none;
}

@keyframes fade-down {
  0% {
    transform: translateY(-2rem);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

// toast
.toast {
  background: #fff;
  padding: 1.5rem 2rem;
  font-size: 1.6rem;
  box-shadow: rgba($color: #000000, $alpha: 0.1) 0 0 2rem;
  margin: 1rem 0;
  border-radius: 3rem;
  min-width: 20rem;
  text-align: center;
  animation: fade-down 0.3s ease 0s 1;
  word-break: break-all;
  &-container {
    position: fixed;
    z-index: 99;
    top: 0;
    left: 20%;
    right: 20%;
    display: flex;
    align-items: center;
    flex-direction: column;
  }
}

// confirm
.confirm {
  background: #fff;
  box-shadow: 0rem 0.3rem 0.7rem 0rem rgba(0, 0, 0, 0.13);
	border-radius: 3rem;
  width: 33rem;
  box-sizing: border-box;
  padding: 5.2rem;
  &-container {
    position: fixed;
    z-index: 88;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba($color: #000000, $alpha: 0.05);
  }
  &-body {
    font-size: 1.4rem;
    line-height: 1.4;
    text-align: center;
  }
  &-footer {
    display: flex;
    justify-content: center;
    margin-top: 5.2rem;
  }
  &-btn {
    display: flex;
    align-items: center;
    height: 3rem;
    padding: 0 2rem;
    text-align: center;
    font-size: 1.4rem;
    cursor: pointer;
    border-radius: 1.5rem;
    background: var(--color-main);
    color: #fff;
    margin: 0 1rem;
  }
  &-cancel {
    background: #cfd5e6;
  }
}

// loading
@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
.loading {
  animation: rotate 2s linear 0s infinite;
}

@import "./element.scss";
